package com.zhentao.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MinIO配置类
 */
@Configuration
@ConfigurationProperties(prefix = "minio")
@Data
public class MinioConfig {
    
    /**
     * MinIO服务地址
     */
    private String endpoint = "http://39.96.169.152:9000";
    
    /**
     * 访问密钥
     */
    private String accessKey = "minioadmin";
    
    /**
     * 秘密密钥
     */
    private String secretKey = "minioadmin";
    
    /**
     * 默认存储桶名称
     */
    private String bucketName = "test";
    
    /**
     * 图片访问域名前缀
     */
    private String imageUrlPrefix = "http://39.96.169.152:9000";
    
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
}

